package com.springboot.jdk.colleciton;

import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * - ConcurrentLinkedQueue
 *
 * @author: zr
 * @date: 2021-10-11
 */
public class ConcurrentLinkedQueueDemo {

    public static void main(String[] args) {
        ConcurrentLinkedQueue<String> concurrentLinkedQueue = new ConcurrentLinkedQueue();
        concurrentLinkedQueue.offer("张三");
        concurrentLinkedQueue.offer("李四");
        concurrentLinkedQueue.offer("王五");
        System.out.println(concurrentLinkedQueue.peek());
        System.out.println(concurrentLinkedQueue.size());
        System.out.println(concurrentLinkedQueue.poll());

        Iterator<String> iterator = concurrentLinkedQueue.iterator();
        if (iterator.hasNext()) {
            System.out.println(iterator.next());
        }

    }
}
